package com.huluobo.a2203kotlinjetpackdemo.paging

import androidx.room.Database
import androidx.room.Room
import androidx.room.RoomDatabase
import com.huluobo.a2203kotlinjetpackdemo.App

/**
 *  Created by LC on 2024/7/23.
 */
@Database(entities = [Bean::class], version = 1, exportSchema = true)
abstract class AppDatabase : RoomDatabase() {
    abstract fun getBeanDao(): BeanDao

    companion object {
        val instance = AppDatabaseHolder.db
    }

    private object AppDatabaseHolder {
        val db: AppDatabase = Room.databaseBuilder(
            App.instance, AppDatabase::class.java, "koltin.db"
        ).allowMainThreadQueries().build()
    }
}